<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <title>小药店管理系统 - Layui</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="format-detection" content="telephone=no">

    <link rel="stylesheet" href="layui/css/layui.css"  media="all">
    <style>
        /* 移动端 */
        @media screen and (max-width: 768px) {
            .layui-layout-admin .layui-layout-left,
            .layui-layout-admin .layui-body,
            .layui-layout-admin .layui-footer {left: 0;}
            .layui-layout-admin .layui-side {left: -300px;}
        }
        body {
            font-family: Arial, sans-serif;
            background-color: #f4f4f4;
            margin: 0;
            padding: 20px;
        }
        .container {
            background-color: #fff;
            padding: 20px;
            border-radius: 10px;
            box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
            max-width: 600px;
            margin: 0 auto;
        }
        .form-group {
            margin-bottom: 30px;
        }
        .form-group label {
            display: block;
            margin-bottom: 5px;
        }
        .form-group input, .form-group select, .form-group textarea {
            width: 100%;
            padding: 8px;
            box-sizing: border-box;
        }
        .form-group select {
            height: 40px;
        }
        .btn {
            display: block;
            width: 100%;
            padding: 10px;
            background-color: #4caf50;
            color: white;
            border: none;
            border-radius: 5px;
            cursor: pointer;
        }
        /* 设置背景颜色为白色 */
        .layui-side {
            background-color: white !important;
        }

        /* 设置文字颜色为黑色 */
        .layui-nav .layui-nav-item a {
            color: black !important;
        }

        /* 设置子菜单背景颜色 */
        .layui-nav .layui-nav-child dd{
            background-color: #FFFFFF; /* 自定义颜色 */
        }

        /* 设置鼠标悬停时子菜单项的颜色 */
        .layui-nav .layui-nav-child a:hover {
            color: #00F7DE !important; /* 自定义颜色 */
        }
        .layui-nav .layui-nav-child{
            padding: 0;
            margin: 0;
        }
    </style>
</head>
<body>

<div class="layui-layout layui-layout-admin">
    <div class="layui-header layui-bg-gray">

        <div class="layui-logo layui-hide-xs layui-bg-green">夏令营技术研发平台</div>


        <ul class="layui-nav layui-layout-right">
            <li class="layui-nav-item layui-hide layui-show-md-inline-block">
                <a href="javascript:;">
                    <img src="https://layui.wc-os.com/other/crop.0.0.118.118.180/5db11ff4gw1e77d3nqrv8j203b03cweg.jpg" tppabs="http://tva1.sinaimg.cn/crop.0.0.118.118.180/5db11ff4gw1e77d3nqrv8j203b03cweg.jpg" class="layui-nav-img">
                    超级管理员
                </a>
                <dl class="layui-nav-child">
                    <dd><a href="">个人信息</a></dd>
                    <dd><a href="">设置</a></dd>
                    <dd><a href="">退出</a></dd>
                </dl>
            </li>
        </ul>
    </div>

    <div class="layui-side">
        <div class="layui-side-scroll">
            <!-- 左侧导航区域（可配合layui已有的垂直导航） -->
            <ul class="layui-nav layui-nav-tree layui-bg-gray" lay-filter="test">
                <li class="layui-nav-item ">
                    <a class="" href="javascript:;">采购管理</a>
                    <dl class="layui-nav-child">
                        <dd><a href="supplier.html">供应商管理</a></dd><!--输出信息流界面-->
                        <dd><a href="drug_info.html">药品基本信息管理</a></dd><!--输出信息流界面-->
                        <dd><a href="purchase_ord_add.html">采购单添加</a></dd><!--接表单界面-->
                        <dd><a href="purchase_ord_data.html">采购细明管理</a></dd><!--输出信息流界面-->
                    </dl>
                </li>
                <li class="layui-nav-item">
                    <a href="javascript:;">销售管理</a>
                    <dl class="layui-nav-child">
                        <dd><a href="sell_add.html">销售单添加管理</a></dd><!--接表单界面可提交到后端-->
                        <dd><a href="sell_ord_data.html">销售单明细管理</a></dd><!--输出信息流界面-->
                    </dl>
                </li>
                <li class="layui-nav-item">
                    <a href="javascript:;">药店统计管理</a>
                    <dl class="layui-nav-child">
                        <dd><a href="warehousing_sta.html">入库统计</a></dd>
                        <dd><a href="sell_sta.html">销售统计</a></dd>
                        <dd><a href="inve_insert.html">库存查询</a></dd>
                    </dl>
                </li>
                <li class="layui-nav-item layui-nav-itemed">
                    <a href="javascript:;">人事管理</a>
                    <dl class="layui-nav-child">
                        <dd><a href="user_add.html">员工添加</a></dd>
                        <dd><a href="user.html">员工管理</a></dd>
                    </dl>
                </li>
                <li class="layui-nav-item">
                    <a href="javascript:;">打印管理</a>
                    <dl class="layui-nav-child">
                        <dd><a href="join_inve_prt.html">入库单打印</a></dd>
                        <dd><a href="out_inve_prt.html">出库单打印</a></dd>
                    </dl>
                </li>
                <li class="layui-nav-item">
                    <a href="javascript:;">系统管理</a>
                    <dl class="layui-nav-child">
                        <dd><a href="login_mage.html">登录管理</a></dd>
                    </dl>
                </li>
            </ul>
        </div>
    </div>


    <div class="layui-body">
        <!-- 内容主体区域 -->
        <span class="layui-breadcrumb">
          <a href="index.html"></a>
          <a> <cite>首页</cite></a>
          <a> <cite>员工管理</cite></a>
          <a> <cite>员工添加</cite></a>
        </span>

        <div class="container">
            <title>添加员工</title>
                <div class="container">
                    <h2>添加员工</h2>
                    <div class="layui-field-box">
                        <div class="layui-form-item layui-form-pane">
                            <label class="layui-form-label">姓名</label>
                            <div class="layui-input-inline">
                                <input type="text" id="insert_name" class="layui-input" placeholder="请输入姓名">
                            </div>
                        </div>

                        <div class="layui-form-item layui-form-pane">
                            <label class="layui-form-label">性别</label>
                            <div class="layui-input-inline">
                                <input type="text" id="insert_sex" class="layui-input" placeholder="请输入性别">
                            </div>
                        </div>

                        <div class="layui-form-item layui-form-pane">
                            <label class="layui-form-label">年龄</label>
                            <div class="layui-input-inline">
                                <input type="text" id="insert_age" class="layui-input" placeholder="请输入年龄">
                            </div>
                        </div>

                        <div class="layui-form-item layui-form-pane">
                            <label class="layui-form-label">电话</label>
                            <div class="layui-input-inline">
                                <input type="text" id="insert_tel" class="layui-input" placeholder="请输入电话">
                            </div>
                        </div>

                        <div class="layui-form-item layui-form-pane">
                            <label class="layui-form-label">地址</label>
                            <div class="layui-input-inline">
                                <input type="text" id="insert_adress" class="layui-input" placeholder="请输入地址">
                            </div>
                        </div>

                        <div class="layui-form-item layui-form-pane">
                            <label class="layui-form-label">职位</label>
                            <div class="layui-input-inline">
                                <input type="text" id="insert_zhiwei" class="layui-input" placeholder="请输入职位">
                            </div>
                        </div>

                        <div class="layui-form-item layui-form-pane">
                            <label class="layui-form-label">状态</label>
                            <div class="layui-input-inline">
                                <input type="text" id="insert_status" class="layui-input" placeholder="请输入状态">
                            </div>
                        </div>

                        <div class="layui-form-item layui-form-pane">
                            <label class="layui-form-label">权限</label>
                            <div class="layui-input-inline">
                                <input type="text" id="insert_user_id" class="layui-input" placeholder="请输入权限">
                            </div>
                        </div>
                    </div>
                    <button class="layui-btn" id="iReset" style="margin: auto; display: block;">提交</button>
                </div>
        </div>
    </div>

    <div class="layui-footer">
        ©CopyRight 2020-2024夏令营技术研发组
    </div>
</div>
<script src="layui/layui.js"  charset="utf-8"></script>
<script src="jquery/jquery-3.6.0.js" charset="utf-8"></script>
<script>
    //JS
    layui.use(['element', 'layer', 'util'], function(){
        var element = layui.element
            ,layer = layui.layer
            ,util = layui.util
            ,$ = layui.$;

        //头部事件
        util.event('lay-header-event', {
            //左侧菜单事件
            menuLeft: function(othis){
                layer.msg('展开左侧菜单的操作', {icon: 0});
            }
            ,menuRight: function(){
                layer.open({
                    type: 1
                    ,title: '更多'
                    ,content: '<div style="padding: 15px;">处理右侧面板的操作</div>'
                    ,area: ['260px', '100%']
                    ,offset: 'rt' //右上角
                    ,anim: 5
                    ,shadeClose: true
                    ,scrollbar: false
                });
            }
        });

    });
</script>
<script>
    // 引入自定义表单
    $("#iReset").click(function(){            // 这个是新增按钮点击事件
        let name = $("#insert_name").val();
        let sex = $("#insert_sex").val();
        let age = $("#insert_age").val();
        let tel = $("#insert_tel").val();
        let adress = $("#insert_adress").val();
        let zhiwei = $("#insert_zhiwei").val();
        let status = $("#insert_status").val();
        let user_id = $("#insert_user_id").val();

        // ajax
        $.ajax({
            url: "/employee/insert_Employee",           // 请求路径
            type: "POST",                  // 请求的方式，不区分大小写
            cache: false,                  // 关闭缓存，目的是为了避免部分浏览器缓存加载出错(IE)
            contentType: "application/json;charset=utf-8",   // 告知浏览器，当前传递到后端服务的是一个json对象
            data: JSON.stringify({
                name: name,
                sex: sex,
                age: age,
                tel: tel,
                adress: adress,
                zhiwei: zhiwei,
                status: status,
                user_Id: user_id
            }),
            success: function(response){
                console.log("返回: " + response);
                if(response.code === 200) {
                    layer.msg("新增用户成功!");
                    window.location.href = "/user.html";
                }
            },
            error: function(jqXHR, textStatus, errorThrown){
                console.log("出错返回: " + jqXHR.responseText);
            }
        });
    });
</script>
</body>
</html>
